home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / g_public.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  12.2 KB  |  377 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3.  
  4. // g_public.h -- game module information visible to server
  5.  
  6. #define    GAME_API_VERSION    7
  7.  
  8. // entity->svFlags
  9. // the server does not know how to interpret most of the values
  10. // in entityStates (level eType), so the game must explicitly flag
  11. // special server behaviors
  12. #define    SVF_NOCLIENT            0x00000001    // don't send entity to clients, even if it has effects
  13. #define SVF_BOT                    0x00000008
  14. #define    SVF_BROADCAST            0x00000020    // send to all connected clients
  15. #define    SVF_PORTAL                0x00000040    // merge a second pvs at origin2 into snapshots
  16. #define    SVF_USE_CURRENT_ORIGIN    0x00000080    // entity->r.currentOrigin instead of entity->s.origin
  17.                                             // for link position (missiles and movers)
  18.  
  19. //===============================================================
  20.  
  21.  
  22. typedef struct {
  23.     entityState_t    s;                // communicated by server to clients
  24.  
  25.     qboolean    linked;                // qfalse if not in any good cluster
  26.     int            linkcount;
  27.  
  28.     int            svFlags;            // SVF_NOCLIENT, SVF_BROADCAST, etc
  29.  
  30.     qboolean    bmodel;                // if false, assume an explicit mins / maxs bounding box
  31.                                     // only set by trap_SetBrushModel
  32.     vec3_t        mins, maxs;
  33.     int            contents;            // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc
  34.                                     // a non-solid entity should set to 0
  35.  
  36.     vec3_t        absmin, absmax;        // derived from mins/maxs and origin + rotation
  37.  
  38.     // currentOrigin will be used for all collision detection and world linking.
  39.     // it will not necessarily be the same as the trajectory evaluation for the current
  40.     // time, because each entity must be moved one at a time after time is advanced
  41.     // to avoid simultanious collision issues
  42.     vec3_t        currentOrigin;
  43.     vec3_t        currentAngles;
  44.  
  45.     // when a trace call is made and passEntityNum != ENTITYNUM_NONE,
  46.     // an ent will be excluded from testing if:
  47.     // ent->s.number == passEntityNum    (don't interact with self)
  48.     // ent->s.ownerNum = passEntityNum    (don't interact with your own missiles)
  49.     // entity[ent->s.ownerNum].ownerNum = passEntityNum    (don't interact with other missiles from owner)
  50.     int            ownerNum;
  51. } entityShared_t;
  52.  
  53.  
  54.  
  55. // the server looks at a sharedEntity, which is the start of the game's gentity_t structure
  56. typedef struct {
  57.     entityState_t    s;                // communicated by server to clients
  58.     entityShared_t    r;                // shared by both the server system and game
  59. } sharedEntity_t;
  60.  
  61.  
  62.  
  63. //===============================================================
  64.  
  65. //
  66. // system traps provided by the main engine
  67. //
  68. typedef enum {
  69.     //============== general Quake services ==================
  70.  
  71.     G_PRINT,        // ( const char *string );
  72.     // print message on the local console
  73.  
  74.     G_ERROR,        // ( const char *string );
  75.     // abort the game
  76.  
  77.     G_MILLISECONDS,    // ( void );
  78.     // get current time for profiling reasons
  79.     // this should NOT be used for any game related tasks,
  80.     // because it is not journaled
  81.  
  82.     // console variable interaction
  83.     G_CVAR_REGISTER,    // ( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
  84.     G_CVAR_UPDATE,    // ( vmCvar_t *vmCvar );
  85.     G_CVAR_SET,        // ( const char *var_name, const char *value );
  86.     G_CVAR_VARIABLE_INTEGER_VALUE,    // ( const char *var_name );
  87.  
  88.     G_CVAR_VARIABLE_STRING_BUFFER,    // ( const char *var_name, char *buffer, int bufsize );
  89.  
  90.     G_ARGC,            // ( void );
  91.     // ClientCommand and ServerCommand parameter access
  92.  
  93.     G_ARGV,            // ( int n, char *buffer, int bufferLength );
  94.  
  95.     G_FS_FOPEN_FILE,    // ( const char *qpath, fileHandle_t *file, fsMode_t mode );
  96.     G_FS_READ,        // ( void *buffer, int len, fileHandle_t f );
  97.     G_FS_WRITE,        // ( const void *buffer, int len, fileHandle_t f );
  98.     G_FS_FCLOSE_FILE,        // ( fileHandle_t f );
  99.  
  100.     G_SEND_CONSOLE_COMMAND,    // ( const char *text );
  101.     // add commands to the console as if they were typed in
  102.     // for map changing, etc
  103.  
  104.  
  105.     //=========== server specific functionality =============
  106.  
  107.     G_LOCATE_GAME_DATA,        // ( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t,
  108.     //                            playerState_t *clients, int sizeofGameClient );
  109.     // the game needs to let the server system know where and how big the gentities
  110.     // are, so it can look at them directly without going through an interface
  111.  
  112.     G_DROP_CLIENT,        // ( int clientNum, const char *reason );
  113.     // kick a client off the server with a message
  114.  
  115.     G_SEND_SERVER_COMMAND,    // ( int clientNum, const char *fmt, ... );
  116.     // reliably sends a command string to be interpreted by the given
  117.     // client.  If clientNum is -1, it will be sent to all clients
  118.  
  119.     G_SET_CONFIGSTRING,    // ( int num, const char *string );
  120.     // config strings hold all the index strings, and various other information
  121.     // that is reliably communicated to all clients
  122.     // All of the current configstrings are sent to clients when
  123.     // they connect, and changes are sent to all connected clients.
  124.     // All confgstrings are cleared at each level start.
  125.  
  126.     G_GET_CONFIGSTRING,    // ( int num, char *buffer, int bufferSize );
  127.  
  128.     G_GET_USERINFO,        // ( int num, char *buffer, int bufferSize );
  129.     // userinfo strings are maintained by the server system, so they
  130.     // are persistant across level loads, while all other game visible
  131.     // data is completely reset
  132.  
  133.     G_SET_USERINFO,        // ( int num, const char *buffer );
  134.  
  135.     G_GET_SERVERINFO,    // ( char *buffer, int bufferSize );
  136.     // the serverinfo info string has all the cvars visible to server browsers
  137.  
  138.     G_SET_BRUSH_MODEL,    // ( gentity_t *ent, const char *name );
  139.     // sets mins and maxs based on the brushmodel name
  140.  
  141.     G_TRACE,    // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
  142.     // collision detection against all linked entities
  143.  
  144.     G_POINT_CONTENTS,    // ( const vec3_t point, int passEntityNum );
  145.     // point contents against all linked entities
  146.  
  147.     G_IN_PVS,            // ( const vec3_t p1, const vec3_t p2 );
  148.  
  149.     G_IN_PVS_IGNORE_PORTALS,    // ( const vec3_t p1, const vec3_t p2 );
  150.  
  151.     G_ADJUST_AREA_PORTAL_STATE,    // ( gentity_t *ent, qboolean open );
  152.  
  153.     G_AREAS_CONNECTED,    // ( int area1, int area2 );
  154.  
  155.     G_LINKENTITY,        // ( gentity_t *ent );
  156.     // an entity will never be sent to a client or used for collision
  157.     // if it is not passed to linkentity.  If the size, position, or
  158.     // solidity changes, it must be relinked.
  159.  
  160.     G_UNLINKENTITY,        // ( gentity_t *ent );        
  161.     // call before removing an interactive entity
  162.  
  163.     G_ENTITIES_IN_BOX,    // ( const vec3_t mins, const vec3_t maxs, gentity_t **list, int maxcount );
  164.     // EntitiesInBox will return brush models based on their bounding box,
  165.     // so exact determination must still be done with EntityContact
  166.  
  167.     G_ENTITY_CONTACT,    // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
  168.     // perform an exact check against inline brush models of non-square shape
  169.  
  170.     // access for bots to get and free a server client (FIXME?)
  171.     G_BOT_ALLOCATE_CLIENT,    // ( void );
  172.  
  173.     G_BOT_FREE_CLIENT,    // ( int clientNum );
  174.  
  175.     G_GET_USERCMD,    // ( int clientNum, usercmd_t *cmd )
  176.  
  177.     G_GET_ENTITY_TOKEN,    // qboolean ( char *buffer, int bufferSize )
  178.     // Retrieves the next string token from the entity spawn text, returning
  179.     // false when all tokens have been parsed.
  180.     // This should only be done at GAME_INIT time.
  181.  
  182.     G_FS_GETFILELIST,
  183.     G_DEBUG_POLYGON_CREATE,
  184.     G_DEBUG_POLYGON_DELETE,
  185.  
  186.     BOTLIB_SETUP = 200,                // ( void );
  187.     BOTLIB_SHUTDOWN,                // ( void );
  188.     BOTLIB_LIBVAR_SET,
  189.     BOTLIB_LIBVAR_GET,
  190.     BOTLIB_DEFINE,
  191.     BOTLIB_START_FRAME,
  192.     BOTLIB_LOAD_MAP,
  193.     BOTLIB_UPDATENTITY,
  194.     BOTLIB_TEST,
  195.  
  196.     BOTLIB_GET_SNAPSHOT_ENTITY,        // ( int client, int ent );
  197.     BOTLIB_GET_CONSOLE_MESSAGE,        // ( int client, char *message, int size );
  198.     BOTLIB_USER_COMMAND,            // ( int client, usercmd_t *ucmd );
  199.  
  200.     BOTLIB_AAS_ENTITY_VISIBLE = 300,    //FIXME: remove
  201.     BOTLIB_AAS_IN_FIELD_OF_VISION,        //FIXME: remove
  202.     BOTLIB_AAS_VISIBLE_CLIENTS,            //FIXME: remove
  203.     BOTLIB_AAS_ENTITY_INFO,
  204.  
  205.     BOTLIB_AAS_INITIALIZED,
  206.     BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX,
  207.     BOTLIB_AAS_TIME,
  208.  
  209.     BOTLIB_AAS_POINT_AREA_NUM,
  210.     BOTLIB_AAS_TRACE_AREAS,
  211.  
  212.     BOTLIB_AAS_POINT_CONTENTS,
  213.     BOTLIB_AAS_NEXT_BSP_ENTITY,
  214.     BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY,
  215.     BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY,
  216.     BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY,
  217.     BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY,
  218.  
  219.     BOTLIB_AAS_AREA_REACHABILITY,
  220.  
  221.     BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA,
  222.  
  223.     BOTLIB_AAS_SWIMMING,
  224.     BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT,
  225.  
  226.  
  227.  
  228.     BOTLIB_EA_SAY = 400,
  229.     BOTLIB_EA_SAY_TEAM,
  230.     BOTLIB_EA_USE_ITEM,
  231.     BOTLIB_EA_DROP_ITEM,
  232.     BOTLIB_EA_USE_INV,
  233.     BOTLIB_EA_DROP_INV,
  234.     BOTLIB_EA_GESTURE,
  235.     BOTLIB_EA_COMMAND,
  236.  
  237.     BOTLIB_EA_SELECT_WEAPON,
  238.     BOTLIB_EA_TALK,
  239.     BOTLIB_EA_ATTACK,
  240.     BOTLIB_EA_USE,
  241.     BOTLIB_EA_RESPAWN,
  242.     BOTLIB_EA_JUMP,
  243.     BOTLIB_EA_DELAYED_JUMP,
  244.     BOTLIB_EA_CROUCH,
  245.     BOTLIB_EA_MOVE_UP,
  246.     BOTLIB_EA_MOVE_DOWN,
  247.     BOTLIB_EA_MOVE_FORWARD,
  248.     BOTLIB_EA_MOVE_BACK,
  249.     BOTLIB_EA_MOVE_LEFT,
  250.     BOTLIB_EA_MOVE_RIGHT,
  251.     BOTLIB_EA_MOVE,
  252.     BOTLIB_EA_VIEW,
  253.  
  254.     BOTLIB_EA_END_REGULAR,
  255.     BOTLIB_EA_GET_INPUT,
  256.     BOTLIB_EA_RESET_INPUT,
  257.  
  258.  
  259.  
  260.     BOTLIB_AI_LOAD_CHARACTER = 500,
  261.     BOTLIB_AI_FREE_CHARACTER,
  262.     BOTLIB_AI_CHARACTERISTIC_FLOAT,
  263.     BOTLIB_AI_CHARACTERISTIC_BFLOAT,
  264.     BOTLIB_AI_CHARACTERISTIC_INTEGER,
  265.     BOTLIB_AI_CHARACTERISTIC_BINTEGER,
  266.     BOTLIB_AI_CHARACTERISTIC_STRING,
  267.  
  268.     BOTLIB_AI_ALLOC_CHAT_STATE,
  269.     BOTLIB_AI_FREE_CHAT_STATE,
  270.     BOTLIB_AI_QUEUE_CONSOLE_MESSAGE,
  271.     BOTLIB_AI_REMOVE_CONSOLE_MESSAGE,
  272.     BOTLIB_AI_NEXT_CONSOLE_MESSAGE,
  273.     BOTLIB_AI_NUM_CONSOLE_MESSAGE,
  274.     BOTLIB_AI_INITIAL_CHAT,
  275.     BOTLIB_AI_REPLY_CHAT,
  276.     BOTLIB_AI_CHAT_LENGTH,
  277.     BOTLIB_AI_ENTER_CHAT,
  278.     BOTLIB_AI_STRING_CONTAINS,
  279.     BOTLIB_AI_FIND_MATCH,
  280.     BOTLIB_AI_MATCH_VARIABLE,
  281.     BOTLIB_AI_UNIFY_WHITE_SPACES,
  282.     BOTLIB_AI_REPLACE_SYNONYMS,
  283.     BOTLIB_AI_LOAD_CHAT_FILE,
  284.     BOTLIB_AI_SET_CHAT_GENDER,
  285.     BOTLIB_AI_SET_CHAT_NAME,
  286.  
  287.     BOTLIB_AI_RESET_GOAL_STATE,
  288.     BOTLIB_AI_RESET_AVOID_GOALS,
  289.     BOTLIB_AI_PUSH_GOAL,
  290.     BOTLIB_AI_POP_GOAL,
  291.     BOTLIB_AI_EMPTY_GOAL_STACK,
  292.     BOTLIB_AI_DUMP_AVOID_GOALS,
  293.     BOTLIB_AI_DUMP_GOAL_STACK,
  294.     BOTLIB_AI_GOAL_NAME,
  295.     BOTLIB_AI_GET_TOP_GOAL,
  296.     BOTLIB_AI_GET_SECOND_GOAL,
  297.     BOTLIB_AI_CHOOSE_LTG_ITEM,
  298.     BOTLIB_AI_CHOOSE_NBG_ITEM,
  299.     BOTLIB_AI_TOUCHING_GOAL,
  300.     BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE,
  301.     BOTLIB_AI_GET_LEVEL_ITEM_GOAL,
  302.     BOTLIB_AI_AVOID_GOAL_TIME,
  303.     BOTLIB_AI_INIT_LEVEL_ITEMS,
  304.     BOTLIB_AI_UPDATE_ENTITY_ITEMS,
  305.     BOTLIB_AI_LOAD_ITEM_WEIGHTS,
  306.     BOTLIB_AI_FREE_ITEM_WEIGHTS,
  307.     BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC,
  308.     BOTLIB_AI_ALLOC_GOAL_STATE,
  309.     BOTLIB_AI_FREE_GOAL_STATE,
  310.  
  311.     BOTLIB_AI_RESET_MOVE_STATE,
  312.     BOTLIB_AI_MOVE_TO_GOAL,
  313.     BOTLIB_AI_MOVE_IN_DIRECTION,
  314.     BOTLIB_AI_RESET_AVOID_REACH,
  315.     BOTLIB_AI_RESET_LAST_AVOID_REACH,
  316.     BOTLIB_AI_REACHABILITY_AREA,
  317.     BOTLIB_AI_MOVEMENT_VIEW_TARGET,
  318.     BOTLIB_AI_ALLOC_MOVE_STATE,
  319.     BOTLIB_AI_FREE_MOVE_STATE,
  320.     BOTLIB_AI_INIT_MOVE_STATE,
  321.  
  322.     BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON,
  323.     BOTLIB_AI_GET_WEAPON_INFO,
  324.     BOTLIB_AI_LOAD_WEAPON_WEIGHTS,
  325.     BOTLIB_AI_ALLOC_WEAPON_STATE,
  326.     BOTLIB_AI_FREE_WEAPON_STATE,
  327.     BOTLIB_AI_RESET_WEAPON_STATE,
  328.  
  329.     BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION,
  330.     BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC,
  331.     BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC,
  332.     BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL,
  333.     BOTLIB_AI_GET_MAP_LOCATION_GOAL,
  334.     BOTLIB_AI_NUM_INITIAL_CHATS,
  335.     BOTLIB_AI_GET_CHAT_MESSAGE,
  336.     BOTLIB_AI_REMOVE_FROM_AVOID_GOALS,
  337.     BOTLIB_AI_PREDICT_VISIBLE_POSITION
  338. } gameImport_t;
  339.  
  340.  
  341. //
  342. // functions exported by the game subsystem
  343. //
  344. typedef enum {
  345.     GAME_INIT,    // ( int levelTime, int randomSeed, int restart );
  346.     // init and shutdown will be called every single level
  347.     // The game should call G_GET_ENTITY_TOKEN to parse through all the
  348.     // entity configuration text and spawn gentities.
  349.  
  350.     GAME_SHUTDOWN,    // (void);
  351.  
  352.     GAME_CLIENT_CONNECT,    // ( int clientNum, qboolean firstTime, qboolean isBot );
  353.     // return NULL if the client is allowed to connect, otherwise return
  354.     // a text string with the reason for denial
  355.  
  356.     GAME_CLIENT_BEGIN,                // ( int clientNum );
  357.  
  358.     GAME_CLIENT_USERINFO_CHANGED,    // ( int clientNum );
  359.  
  360.     GAME_CLIENT_DISCONNECT,            // ( int clientNum );
  361.  
  362.     GAME_CLIENT_COMMAND,            // ( int clientNum );
  363.  
  364.     GAME_CLIENT_THINK,                // ( int clientNum );
  365.  
  366.     GAME_RUN_FRAME,                    // ( int levelTime );
  367.  
  368.     GAME_CONSOLE_COMMAND,            // ( void );
  369.     // ConsoleCommand will be called when a command has been issued
  370.     // that is not recognized as a builtin function.
  371.     // The game can issue trap_argc() / trap_argv() commands to get the command
  372.     // and parameters.  Return qfalse if the game doesn't recognize it as a command.
  373.  
  374.     BOTAI_START_FRAME                // ( int time );
  375. } gameExport_t;
  376.  
  377.